<template>
	<view class="Global">
		<bgImage></bgImage>
		<MyNav :title="title" bgColor="" :backIcon="isback"></MyNav>
		<view class="title">{{FactoryName}}</view>
		<view class="content">个人或小型作坊可为多家工厂提供服务，员工 先注册，再扫如下工厂码加入工厂，切换工厂 后即可登记该工厂的订单数据</view>
		<view class="qrCode">
			<uqrcode ref="uqrcode" canvas-id="qrcode" :value="qrCodeContent" :options="options"></uqrcode>
		</view>

		<view class="loginContent">

			<button @click="addClick()" style="color:#ffffff" class="login" type="default">{{add}}</button>
		</view>

	</view>
</template>

<script>
	import bgImage from '@/components/backgroundImage.vue'

	import MyNav from '@/components/customnavbar.vue'







	// 或者
	import uqrcode from '@/subPackA/uni_modules/Sansnn-uQRCode/components/uqrcode/uqrcode.vue'; // npm install @uqrcode/js
	export default {
		components: {

			bgImage,
			uqrcode,
			MyNav
		},
		data() {
			return {
				add: '新增',


				title: '二维码',
				isback: true,
				FactoryName: '',


				options: {
					margin: 10
				},

				qrCodeContent: '',


			}
		},
		onLoad(e) {
			console.log('获取工厂名称' + e.storeName);
			this.FactoryName = e.storeName

			const app = getApp();
			// this.user.storeId = app.globalData.storeId
			// this.user.tenantId = app.globalData.tenantId 

			// 生成跳转链接
			/* 	var appId = 'wxa926d93d8640a7e6';
				var path = 'subPackA/quickLogin/quickLogin';
				var query = 'storeId='+app.globalData.storeId+'&tenantId='+app.globalData.tenantId ;
				var jumpUrl = `https://zhiyi-test.yuandouxinxi.com/${appId}/${path}?${query}`; */
			var jumpUrl = 'https://zhiyi-test.yuandouxinxi.com?' + 'storeId=' + app.globalData.storeId + '&tenantId=' + app
				.globalData.tenantId
			console.log('二维码内容' + jumpUrl);
			this.qrCodeContent = jumpUrl

		},
		methods: {

// 	新增工厂
			addClick() {
				
				uni.navigateTo({
					url: '/subPackA/AddFactory/AddFactory',
					success: res => {},
					fail: () => {},
					complete: () => {}
				});

			},

		}
	}
</script>

<style>
	.loginContent {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		width: 750rpx;


	}

	.login {
		display: flex;
		justify-content: center;
		align-items: center;
		margin-top: 20rpx;
		width: 550rpx;
		height: 110rpx;

		border-radius: 30rpx;
		font-weight: 400;
		font-size: 36rpx;
		color: #FFFFFF;
		text-align: center;
		font-weight: bold;

		margin-top: 60rpx;
		background: linear-gradient(90deg, #45A8FF, #0AE1C6);

	}

	.qrCode {
		display: flex;
		justify-content: center;
		align-items: center;

		margin-top: 50rpx;
	}

	.qrcodeContent {
		width: 200rpx;
		height: 200rpx;
	}

	.content {

		width: 559rpx;
		height: 107rpx;
		font-family: HarmonyOS Sans SC;
		font-weight: 400;
		font-size: 28rpx;
		color: #333333;
		line-height: 40rpx;

	}

	.title {
		margin-top: 179rpx;
		text-align: center;
		font-size: 80rpx;
		font-weight: bold;
	}
</style>